<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0037)http://777.sucaishui.com/plus/car.php -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>购物车 - 订单号:S-P1532737655RN686</title>

<link href="./gouwuche/bootstrap.min.css" rel="stylesheet" media="screen" type="text/css">
<link href="./gouwuche/bootstrap-extend.min.css" rel="stylesheet" media="screen" type="text/css">
<link href="./gouwuche/shop.css" rel="stylesheet" media="screen" type="text/css">
<link href="./gouwuche/site.min.css" rel="stylesheet" media="screen" type="text/css">
<link href="./gouwuche/web-icons.min.css" rel="stylesheet" media="screen" type="text/css">
<script type="text/javascript" language="javascript" src="./gouwuche/j.js.下载"></script>

<script language="javascript" type="text/javascript" src="./gouwuche/jquery1.42.min.js.下载"></script><!--引入jquery,文件放在在默认模板的js目录下-->
<!--全选s--> 
<script type="text/javascript">
function selectGroup(checkbox,obj) { 
$('input[name='+obj+']').attr('checked', $(checkbox).attr('checked')); 
} 
</script> 
<!--全选e-->
<!--js加减s-->
<script type="text/javascript"> 
$(function(){ 
  $(".add").click(function(){ 
    var t=$(this).parent().find('input[class*=text_box]'); 
    t.val(parseInt(t.val())+1) 
    setTotal(); 
  }) 
  $(".min").click(function(){ 
    var t=$(this).parent().find('input[class*=text_box]'); 
    t.val(parseInt(t.val())-1) 
    if(parseInt(t.val())<0){ 
      t.val(0); 
    } 
    setTotal(); 
  }) 
  function setTotal(){ 
    var s=0; 
    $(".jg").each(function(){ 
      s+=parseInt($(this).find('input[class*=text_box]').val())*parseFloat($(this).find('span[class*=price]').text());  
    }); 
    var Num=0; 
    $(".jg").each(function(){ 
      Num+=parseInt($(this).find('input[class*=text_box]').val()); 
    }); 
    $("#total").html(s.toFixed(2)); //统计商品总价
    $("#Num").html(Num.toFixed(2)); //统计购物数量
  } 
  setTotal();
})
</script>
<!--js加减e-->

</head>
<body class="buycarpage">




<div class="page">





<div class="container" id="tab">


<div class="panel" style="margin-top:20px;">
			<div class="panel-body cart-total-body animation-fade">
			<div class="welcome">
                        您好,先登录再购物, 请 <a href="lo.jsp">登录</a> 
            		</div>
			</div>
</div>

<form id="form1" name="form1" method="post" action="http://777.sucaishui.com/plus/posttocar.php">
      <input id="dopost" name="do" type="hidden" value="del">
<div class="panel">
  <div class="panel-body cart-list-body animation-fade">
    <div class="table-responsive">
      <table class="table table-hover table-striped">
        <thead>
          <tr>
            <th class="text-center width-100">
              <div class="checkbox-custom checkbox-danger">
                <input class="selectable-all" type="checkbox" onclick="selectGroup(this,&#39;ids[]&#39;);">
                <label></label>
              </div></th>
            <th class="width-300">商品</th>
            <th class="text-center">单价</th>
            <th class="text-center width-150" style="width:130px;">数量</th>
            <th class="text-center">小计</th>
            <th class="text-center width-100">操作</th>
          </tr>
        </thead>
								<c:forEach items="${gwc}" var="gw">
								<tbody>
									<tr>
										<td><div class="checkbox-custom checkbox-danger">
												<input type="checkbox" name="ids[]" value="104"> <label></label>
											</div>
										</td>
										<td><div class="media">
												<div class="media-left">
													<a class="avatar text-middle"
														href="../getAll?id=${gw.id}"><img
														class="img-responsive"
														src="${gw.path}" alt="">
													</a>
												</div>
												<div class="media-body">
													<h4 class="media-heading font-weight-unset">
														<a target="_blank"
															href="../getAll?id=${gw.id}">${gw.name}</a>
													</h4>
												</div>
											</div>
										</td>
										<td class="text-center">${gw.price}元</td>
										<td height="23" class="jg">
											<!--加减s--> <input class="min" name="" type="button" value="-"
											style="padding:0 9px;"> <input name="buynum104"
											type="text" id="buynum104" value="1" size="5" maxlength="5"
											class="text_box" style="width:46px; text-align:center">
											<input class="add" name="" type="button" value="+"
											style="padding:0 7px;"></td>
										<td class="text-center"><span class="red-600 subtotal">${gw.price}元</span>
										</td>
										<td class="text-center"><a
											href="#"
											class="cart-remove"><i class="icon wb-trash"
												aria-hidden="true"></i>
										</a>
										</td>
									</tr>
								</tbody>
								</c:forEach>
        
      </table>
    </div>
  </div>
</div>
<div class="panel">
			<div class="panel-body cart-total-body animation-fade">
				<div class="row">
					<div class="col-md-2 col-sm-2 col-xs-3 cart-all">
						<div class="checkbox-custom checkbox-danger width-100 cartall">
						</div>
					</div>
					<div class="col-md-7 col-sm-6 col-xs-9 text-right">
						<span class="hidden-xs">共 <span class="cart-goodnum"><font id="Num" color="red">1</font></span> 件商品， </span>
						合计 : 
						<span class="total-val red-600"><font color="red">${gwc.get(0).price}</font>元</span>
					</div>
					<div class="col-md-3 col-sm-4 col-xs-12 text-right">
                       <!--  <a onclick="ChangePost()" class="btn btn-lg btn-squared btn-danger padding-horizontal-30 cart-tocheck" style="background:green">更新总价</a> -->
						<a href="../zhifu?id=${id}" class="btn btn-lg btn-squared btn-danger padding-horizontal-30 cart-tocheck">去结算</a>
					</div>               
				</div>
			</div>
</div>
</form>
<div class="moregoods">
			<div class="moregoods-head">
				<h4 class="moregoods-title">购买该商品的用户还购买了</h4>
			</div>
			<div class="moregoods-body">
<div class="row">

<c:forEach items="${list}" var="lists">
<div class="col-md-3 col-sm-4 col-xs-6 moregoods-list animation-fade" data-plugin="appear" data-animate="fade">
	<div class="text-center box">
		<a href="../getAll?id=${lists.id}" target="_blank" class="img" title="${lists.name}"><img src="${lists.path}" class="img-responsive" alt="${lists.name}"></a>
		<a href="../getAll?id=${lists.id}" target="_blank" class="txt" title="${lists.name}">${lists.name}</a>
		
	</div>
</div>
</c:forEach>
</div>
			</div>
		</div>
</div>
</div>
<!--购物车列表操作javascript请不要随意改动-->
<script language="JavaScript" type="text/javascript">
//遍历checkbox使之全选中,或反选
function CheckAll()
{
	for (var i=0;i<document.form1.elements.length;i++)
	{
		var e = document.form1.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
//改变表单dopost值为:update,后submit提交表单
function ChangePost()
{
	CheckAll();
	document.getElementById("dopost").value = 'update';
	document.form1.submit();
}
//改变表单dopost值为:del,后submit提交表单
function DelPost()
{
	document.getElementById("dopost").value = 'del';
	document.form1.submit();
}
//AJAX产生一个新的订单编号
function makeCarId()
{
	$.ajax({type: "POST", url: "car.php", data: "dopost=makeid", dataType: 'text',success: function(result){$("#carId").html(result);}}); 
}
//Print Page
function printPage(oper)
{
	if (oper < 10)
	{
		bdhtml = window.document.body.innerHTML;//获取当前页的html代码
		sprnstr = "<!--startprint"+oper+"-->";//设置打印开始区域
		eprnstr = "<!--endprint"+oper+"-->";//设置打印结束区域
		prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
		prnhtml = prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
		window.document.body.innerHTML = prnhtml;
		window.print();
		window.document.body.innerHTML = bdhtml;
	}else{
		window.print();
	}
}
</script>



<script language="JavaScript" type="text/javascript">
if(!navigator.cookieEnabled)
{
	$('#errorChickCookie').html('您浏览器的 cookie 功能被禁用,请启用此功能!');
	$('.buycar').hide();
}
</script>

</body></html>
